#pragma once
#include "Socket.h"
struct tcp_info;  // 前置声明在命名空间外，否则会去命名空间内找实现
namespace xncc {
namespace foundation {
    class TcpSocket final : public Socket
    {
      public:
        explicit TcpSocket(const std::shared_ptr<XnccAddress>& addr) : Socket(addr) {}

        ~TcpSocket() override;

        TcpSocket(const TcpSocket&)             = delete;
        TcpSocket(const TcpSocket&&)            = delete;
        TcpSocket& operator=(const TcpSocket&)  = delete;
        TcpSocket& operator=(const TcpSocket&&) = delete;

        bool getTcpInfo(struct tcp_info*) const;

        [[nodiscard]] std::string getTcpInfoString() const;

        void bind() override;

        void listen() override;

        int accept(std::shared_ptr<XnccAddress> peeraddr) override;

        void shutdownWrite();

        void setTcpNoDelay(bool on);

        void setKeepAlive(bool on);
    };
}  // namespace foundation
}  // namespace xncc